<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/4
 * Time: 9:34
 */
include_once "../function.php";
include_once "../class/ulevel_class.php";
include_once "../class/bonus_class.php";
$date=date('Y-m-d');
$sql="select sum(pv) as pv from orders where cdate like '%{$date}%'";
$pv=getOne($sql);
$ulevel=new ulevel_class();
$bonus=new bonus_class();
$_iul=$ulevel->getulevelbyulevel(1);
$sql="select * from member where ispay>0";
$query=mysql_query($sql);
$row=getAll($sql);
$con=count($row);
while ($users=mysql_fetch_assoc($query)){
    $b3=$pv['pv']*$_iul['yl13']/100/$con;
    $b3=round($b3,2);
    if ($b3 > 0) {
        $beizhu = $b3 . "分红奖";
        edit_sql("update `member` set b3=b3+" . $b3 . " where id=" . $user['id'] . " ");
        $bonus->bonus_laiyuan($user['id'], $user['nickname'], $user['id'], $user['nickname'], 3, $b3, $beizhu);
    }
}
$bonus->b0bonus();